'use strict';

var router = require('koa-router')();
var koaBody = require('koa-body');
var queryString = require('querystring');

var Index = require('./controller/index');
var Admin = require('./controller/admin');
var Task = require('./controller/task');

router.all('/',koaBody(), Index.index);
router.all('/test',koaBody(), Index.test);

router.get('/admin',koaBody(), Admin.index);
router.get('/admin/login', koaBody(), Admin.login);
router.post('/admin/dologin', koaBody(), Admin.doLogin);
router.post('/admin/addManager',koaBody(), Admin.addManager);
//任务
router.all('/admin/task/add',koaBody(), Task.add);
router.all('/admin/task/doAdd',koaBody(), Task.doAdd);
router.all('/admin/task/edit',koaBody(), Task.edit);
router.post('/admin/task/delete/:id',koaBody(), Task.delete);
router.all('/admin/downloadImageZip/:task_id',koaBody(), Admin.downloadImageZip);

//任务
router.get('/task/detail/:id',koaBody(), Task.detail);
router.get('/task/group/:date',koaBody(), Task.group);
router.post('/task/uploadImage/:id',koaBody(), Task.uploadImage);

//导入文件操作
router.get('/admin/task/export',koaBody(),Admin.export);
router.post('/admin/task/doexport',koaBody(), Admin.doExport);

module.exports = router;